<template>
	<view class="agent-shop">
		<cu-custom bgColor="bg-gradual-orange" :isBack="true">
			<block slot="content">拓店者商家</block>
		</cu-custom>
	
		<my-empty v-if="empty"></my-empty>
		<my-agent :shops="shops" v-for="shops in list" :key="shops.id"></my-agent>
	</view>
</template>

<script>
	import agent from '@/api/agent';
	import MyAgent from '@/components/MyAgent';
	export default {
		data() {
			return {
				list: [],
				empty: false,
			}
		},
		components: {
			MyAgent,
		},
		created() {
			this.loadData()
		},
		methods: {
			loadData() {
				uni.showLoading({
					title: '加载中~'
				})
				setTimeout(() => {
					uni.hideLoading()
				}, 5000)
				agent.shopList().then(res => {
					uni.hideLoading();
					if (res.code === 1) {
						if (res.data.list.length <= 0) {
							this.empty = true;
							this.list = [];
						} else {
							this.empty = false;
							this.list = res.data.list;
						}
					} else {
						this.empty = true;
						this.list = [];
						this.toast(res.msg);
					}
				})
			}
		}
	}
</script>

<style>

</style>
